//package com.whfp.coky.manager
//
//import android.content.Context
//import android.os.Build
//import androidx.annotation.RequiresApi
//import androidx.recyclerview.widget.LinearLayoutManager
//import androidx.recyclerview.widget.RecyclerView
//import com.scwang.smart.refresh.layout.SmartRefreshLayout
//import com.scwang.smart.refresh.layout.api.RefreshLayout
//import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener
//import com.whfp.coky.R
//import com.whfp.coky.action.StatusAction
//import com.whfp.coky.api.response.ListBean
//import com.whfp.coky.other.Constants
//import com.whfp.coky.ui.base.BaseAdapter
//import com.whfp.coky.widget.RecycleViewDividerUtils
//import com.whfp.coky.widget.StatusLayout
//
///**
// *
// *
// * created by coky on 2022/3/21
// */
//@RequiresApi(Build.VERSION_CODES.M)
//open class RecycleManager<T>(
//    val context: Context,
//    val mRecyclerView: RecyclerView,
//    val mRefreshLayout: SmartRefreshLayout,
//    val mStatusLayout: StatusLayout?,
//    val mAdapter: BaseAdapter<*, T>,
//    val listener:RecycleListener
//) : StatusAction {
//
//    internal var page:Int = 0
//    var isLastPage = false
//    val linearLayoutManager by lazy { initLayoutManager() }
//    val deciration by lazy { initDecoration() }
//
//    init {
//        mAdapter.let {
//            it.itemClick {
//                doItemClick()
//            }
//            it.itemLongClick {
//                doItemLongClick()
//            }
//        }
//
//        mRecyclerView.let {
//            it.adapter = mAdapter
//            it.layoutManager = linearLayoutManager
//            it.addItemDecoration(deciration)
//        }
//
//        mRefreshLayout.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener {
//            override fun onRefresh(refreshLayout: RefreshLayout) {
//                page = Constants.PAGE_INDEX
//                isLastPage = false
//                listener.doGetDatas(page)
//            }
//            override fun onLoadMore(refreshLayout: RefreshLayout) {
//                if (isLastPage) mRefreshLayout.finishLoadMoreWithNoMoreData() else listener.doGetDatas(++page)
//            }
//        })
//    }
//
//    fun isFirstPage() = page ==Constants.PAGE_INDEX
//
//
//    fun getDatasDone(list: ListBean<T>){
//        if (page == Constants.PAGE_INDEX) mAdapter.clearData()
//
//        if (list.getData() == null || list.getData()!!.isEmpty()) {
//            showEmpty()
//        } else {
//            mAdapter.addData(list.getData() as MutableList<T>)
//            showComplete()
//        }
//        isLastPage = list.isLastPage()
//    }
//
//
//    override fun getStatusLayout() = mStatusLayout
//
//    open fun initLayoutManager() = LinearLayoutManager(context)
//
//    open fun initDecoration(): RecyclerView.ItemDecoration =
//        RecycleViewDividerUtils(
//            context,
//            LinearLayoutManager.HORIZONTAL, 2,
//            context.resources.getColor(R.color.cj_gary,null)
//        )
//
//
//
//
//    open fun doItemLongClick() {
//
//    }
//
//    open fun doItemClick() {
//
//    }
//
//}
//interface RecycleListener {
//    fun doGetDatas(page:Int)
//}